<template>
  <h6 style="color: crimson">系统管理--><a href="http://localhost:5173/user">用户管理</a>-->用户修改</h6>
  <el-form ref="queryFormRef" :inline="true" :model="queryForm" class="demo-form-inline">

    <el-form-item label="用户登陆名" prop="userAccount">
      <el-input v-model="queryForm.userAccount" style="width: 240px" placeholder="用户登陆名" clearable />
    </el-form-item> <br>
    <el-form-item label="用户姓名" prop="userName">
      <el-input v-model="queryForm.userName" style="width: 240px" placeholder="用户姓名" clearable />
    </el-form-item><br>
    <el-form-item label="用户密码" prop="userPassword">
      <el-input v-model="queryForm.userPassword" style="width: 240px" type="password" placeholder="用户密码"   show-password clearable />
    </el-form-item><br>
    <el-form-item label="手机号" prop="userPhone">
      <el-input v-model="queryForm.userPhone" style="width: 240px" placeholder="手机号" clearable />
    </el-form-item><br>
    <el-form-item label="邮箱号" prop="userEmail">
      <el-input v-model="queryForm.userEmail" style="width: 240px" placeholder="邮箱号" clearable />
    </el-form-item><br>
    <el-form-item>
      <el-button type="primary" @click="updateSubmit">保存</el-button>
    </el-form-item>
  </el-form>
</template>

<script setup>
import {ref,reactive,onMounted,getCurrentInstance} from "vue";
import axios from "@/plugins/axios.js";
import {ElMessage} from "element-plus";
import router from "@/router/index.js";
import {sysUserStore} from "@/stores/sysUserModel.js";
const sysUserModel = sysUserStore();
const input = ref('')

const updateSubmit = () => {
  console.log(sysUserModel.userId)
  axios.postJson('/user/update',queryForm).then(res=>{
    console.log(res)
    if(res.code == 200){
      ElMessage.success('修改成功')
      router.push('/user')
    }
  })
}
const queryForm=reactive({
})
onMounted(()=>{
  queryForm.userId = sysUserModel.userId
  queryForm.userName=sysUserModel.userName
  queryForm.userAccount=sysUserModel.userAccount
  queryForm.userPassword=sysUserModel.userPassword
  queryForm.userPhone= sysUserModel.userPhone
  queryForm.userEmail=sysUserModel.userEmail

})
</script>

<style >

</style>